//
//  AlbumTableViewCell.m
//  Ting
//
//  Created by 安静的美男子 on 14/11/26.
//  Copyright (c) 2014年 安静的美男子. All rights reserved.
//

#import "AlbumTableViewCell.h"

@implementation AlbumTableViewCell

- (void)awakeFromNib {
    // Initialization code
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.photo = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 80, 80)];
        [self.contentView addSubview:_photo];
        
        self.count = [[UILabel alloc]initWithFrame:CGRectMake(90, 40, 80, 30)];
        [self.contentView addSubview:_count];
        self.count.font = [UIFont systemFontOfSize:15];
        self.count.textColor = [UIColor grayColor];
        

        self.title = [[UILabel alloc]initWithFrame:CGRectMake(90, 5, 200, 30)];
        [self.contentView addSubview:_title];
        

        self.pubdate  = [[UILabel alloc]initWithFrame:CGRectMake(180, 40, 120, 30)];
        [self.contentView addSubview:_pubdate];
        self.pubdate.font = [UIFont systemFontOfSize:11];
        self.pubdate.textColor = [UIColor lightGrayColor];
        
        
        
    }
    return self;
    
}
-(void)setModel:(BozhuAlbumModel *)model
{
    [self.photo sd_setImageWithURL:[NSURL URLWithString:model.coverLarge] placeholderImage:[UIImage imageNamed:@"123.gif"]];
    self.title.text = model.title;
    self.count.text = [NSString stringWithFormat:@"节目数%@",model.tracks];
    
    double num1 =  [[NSString stringWithFormat:@"%@",model.updatedAt]doubleValue];
    
    num1  = num1 /1000;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateFormat:@"YYYY-MM-dd"];
    // ----------设置你想要的格式,hh与HH的区别:分别表示12小时制,24小时制
    NSDate*comfromTimesp = [NSDate dateWithTimeIntervalSince1970:num1];
    NSString*str = [formatter stringFromDate:comfromTimesp];
    
    self.pubdate.text= [NSString stringWithFormat:@"更新时间:%@",str];

}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
